<template>
    <div>
        <van-nav-bar title="JD商城" />
        <van-tabs v-model:active="active">
            <van-tab title="标签 1">
                <van-search v-model="value" shape="round" background="#4fc08d" placeholder="请输入搜索关键词" @click="so" />
            </van-tab>
            <van-tab title="标签 2">内容 2</van-tab>
            <van-tab title="标签 3">内容 3</van-tab>
            <van-tab title="标签 4">内容 4</van-tab>
        </van-tabs>

        <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="image in images" :key="image">
                <img :src="image" style="width: 90%; height:220px;" />
            </van-swipe-item>
        </van-swipe>
        <van-grid :column-num="4">
            <van-grid-item v-for="item in catitems"  :icon="item.image_src" />
        </van-grid>
        <div v-for="item in floordata">
            <img :src="item.floor_title.image_src" alt="">
            <div v-for="itema in item.product_list">
                <img :src="itema.image_src" alt="">
            </div>
        </div>


    </div>
</template>

<script setup>
// import {useRouter} from 'vue-router';
// const router = new useRouter();

import router from '@/router';
const so = () => {
    router.push('/home/s')
}
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-3.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
];
import {catitemsApi,floordataApi} from '@/api/api'
import { ref } from 'vue';
let catitems=ref([])
catitemsApi().then(res=>{
    console.log('导航',res)
    catitems.value=res.data.message
    
})
let floordata=ref([])
floordataApi().then(res=>{
    console.log('楼层',res)
    floordata.value=res.data.message
})




</script>

<style lang="scss" scoped></style>